﻿using Ewk.Math.Numerics.PositionalNumeralSystems;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ewk.Math.Numerics.UnitTests.PositionalNumeralSystems
{
    [TestClass]
    public class DecimalTests
    {
        [TestMethod]
        public void When_a_Decimal_is_initialized_with_23_Then_the_value_of_the_Numbers_are_2_3()
        {
            var number = new Decimal(23);

            Assert.AreEqual("23", number.ToString());
            Assert.AreEqual(3, number.Numbers[0]);
            Assert.AreEqual(2, number.Numbers[1]);
        }

        [TestMethod]
        public void When_a_Decimal_is_initialized_with_921_Then_the_value_of_the_Numbers_are_9_2_1()
        {
            var number = new Decimal(921);

            Assert.AreEqual("921", number.ToString());
            Assert.AreEqual(1, number.Numbers[0]);
            Assert.AreEqual(2, number.Numbers[1]);
            Assert.AreEqual(9, number.Numbers[2]);
        }

        [TestMethod]
        public void When_a_Decimal_is_initialized_with_5301_Then_the_value_of_the_Numbers_are_5_3_0_1()
        {
            var number = new Decimal(5301);

            Assert.AreEqual("5301", number.ToString());
            Assert.AreEqual(1, number.Numbers[0]);
            Assert.AreEqual(0, number.Numbers[1]);
            Assert.AreEqual(3, number.Numbers[2]);
            Assert.AreEqual(5, number.Numbers[3]);
        }

        [TestMethod]
        public void When_a_Decimal_is_initialized_with_1000_Then_the_value_of_the_Numbers_are_1_0_0_0()
        {
            var number = new Decimal(1000);

            Assert.AreEqual("1000", number.ToString());
            Assert.AreEqual(0, number.Numbers[0]);
            Assert.AreEqual(0, number.Numbers[1]);
            Assert.AreEqual(0, number.Numbers[2]);
            Assert.AreEqual(1, number.Numbers[3]);
        }

        [TestMethod]
        public void When_a_Decimal_is_initialized_with_801321_Then_the_value_of_the_Numbers_are_8_0_1_3_2_1()
        {
            var number = new Decimal(801321);

            Assert.AreEqual("801321", number.ToString());
            Assert.AreEqual(1, number.Numbers[0]);
            Assert.AreEqual(2, number.Numbers[1]);
            Assert.AreEqual(3, number.Numbers[2]);
            Assert.AreEqual(1, number.Numbers[3]);
            Assert.AreEqual(0, number.Numbers[4]);
            Assert.AreEqual(8, number.Numbers[5]);
        }
    }
}